#pragma once

#include "CDXDevice.h"
#include "CDXBuffer.h"
#include "CResourceLibrary.h"
class CDXEffectLibrary;

#ifdef __SWIG__
%include <typemaps.i>
%include "mui_typemap.i"
%apply SWIGTYPE** OUTPUT {CDXBuffer** pCountSumBuf};
#endif
class CDXPrefixSum : public CDXBase
{
public:
	enum CDXPrefixSum_TYPE
	{
		UINT1, UINT2, UINT3, UINT4, 
		FLOAT1, FLOAT2, FLOAT3, FLOAT4
	};
private:
	CDXBuffer* m_pPingPongBuf;
	HRESULT _PrefixSum(DXGI_FORMAT srvFmt, DXGI_FORMAT uavFmt, LPCSTR srcVarName, LPCSTR dstVarName,
		LPCSTR nameTech, UINT idxPass);
protected:
	CDXEffectLibrary* m_pEffectLibrary;

	CDXBuffer* m_pCountBuf;
	CDXBuffer* m_pCountSumBuf;
	
	HRESULT _InitEffectLibrary();
public:
	CDXPrefixSum(CDXDevice* pDevice);
	virtual ~CDXPrefixSum();
	virtual HRESULT PrefixSum(CDXPrefixSum_TYPE type);
	virtual HRESULT SetCountBuffers(CDXBuffer* pCountBuf, CDXBuffer* pCountSumBuf);
	virtual HRESULT GetCountSumBuf(CDXBuffer** pCountSumBuf);
	
};